import java.util.ArrayList;
import java.util.Scanner;

public class h_9 {
    public static void main(String[] args) {
        ArrayList<Integer> ws=new ArrayList<>();
      for(int i=0;i<=1000;i++){
          ArrayList<Integer> list=new ArrayList<Integer>();
          int k=1;
          while(k<i){
              if (i%k==0){
                  list.add(k);
                    k++;
              }else{
                  k++;
              }
          }
          int sum=0;
          for (Integer in:list
               ) {
              sum=sum+in;
          }
          if(sum==i){
              ws.add(i);
          }
      }
        for (Integer in:ws
             ) {
            System.out.print(in+" ");
        }

    }
}
